'use strict';


import React, {Component} from 'react';

import {
    View,
    Image,
    ImageBackground,
    Dimensions,
    TouchableWithoutFeedback,
    StyleSheet,
    Text,
    TouchableOpacity,
    TextInput,
    ScrollView,
    TouchableHighlight,
    TouchableNativeFeedback,
    Switch,
} from 'react-native';
import {StackNavigator} from 'react-navigation';
import ToastUtil from '../../../../core/utils/toast-util.js';
import {Loading, EasyLoading} from 'react-native-easy-loading';
import DatePicker from 'react-native-datepicker'
import CameraButton from '../../../../core/component/comp.button-camera';
import Color from '../../../../core/constant/color';
import Http from '../../../../core/utils/http';
import MessageItem from '../../../../core/component-biz/comp.message-item';


class QunliaoScene extends React.Component {

    static navigationOptions = ({navigation, screenProps}) => ({
        title: "消息",
        headerTintColor: "white",
        headerStyle: {
            backgroundColor: Color.PRIMARY_COLOR,
            elevation: null
        },
    });

    constructor(props) {
        super(props);

        this.state = {}
        console.log(this.props.screenProps, "-----this.props.screenProps")
    }

    componentDidMount() {

    }

    onPressMessageItem(item,index){
        const { navigate } = this.props.navigation;
        navigate('QunliaoMessage',{title:item.title});
    }

    genMessageListUI() {
        const messageList = [
            {title: "落天一", subTitle: "20", time: "昨天22:16",headUrl:require('../../../../img/icon_head_01.jpg')},
            {title: "大叔萝莉组", subTitle: "天天领取红包", time: "昨天22:16",headUrl:require('../../../../img/icon_head_02.jpg')},
        ];
        const messageUI = messageList.map((item, index) => {
            return (<MessageItem key={`message-list-item-${index}`} headUrl={item.headUrl} title={item.title} subTitle={item.subTitle} rightTitle={item.time} onPress={this.onPressMessageItem.bind(this,item,index)}/>)
        })
        return messageUI
    }

    render() {
        return (
            <ScrollView style={styles.body}>
                {this.genMessageListUI()}
            </ScrollView>
        )
    }

}


const styles = StyleSheet.create({
    container:{
        flex: 1,

    },
    body: {
        backgroundColor: '#EBEBEB',
        flex: 1,
    },
});

export default QunliaoScene;